package app.server.project.main.service.controller;

import app.server.project.core.constants.Def;
import app.server.project.core.http.RespModel;
import app.server.project.main.service.dto.withdraw.WithDrawReq;
import app.server.project.main.service.dto.withdraw.WithDrawStatusReq;
import app.server.project.main.service.dto.withdraw.WithDrawStatusResp;
import app.server.project.main.service.service.withdraw.WithDrawService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 提现模块
 */
@AllArgsConstructor
@RestController
@RequestMapping("/withDraw")
public class WithDrawController {
    private WithDrawService withDrawService;

    /**
     * 提现
     *
     * @param req
     * @param userId
     * @return
     */
    @PostMapping("/doWithDraw")
    public RespModel doWithDraw(@RequestBody WithDrawReq req, @RequestHeader(Def.UserId) long userId) {
        this.withDrawService.doWithDraw(req, userId);
        return RespModel.success();
    }

    /**
     * 提现状态查询
     *
     * @param
     * @param userId
     * @return
     */
    @PostMapping("/getWithDrawStatus")
    public RespModel<WithDrawStatusResp> getWithDrawStatus(@RequestHeader(Def.UserId) long userId, @RequestBody WithDrawStatusReq req) {
        return RespModel.success(this.withDrawService.getWithDrawStatus(userId, req));
    }


}
